home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / ediff.info-2.z / ediff.info-2
Encoding:
GNU Info File  |  1998-05-21  |  45.4 KB  |  1,001 lines

  1. This is Info file ../info/ediff.info, produced by Makeinfo version 1.68
  2. from the input file ediff.texi.
  3.  
  4.    This file documents Ediff, a comprehensive visual interface to Unix
  5. diff and patch utilities.
  6.  
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.  
  11. 
  12. File: ediff.info,  Node: Window and Frame Configuration,  Next: Selective Browsing,  Prev: Quick Help Customization,  Up: Customization
  13.  
  14. Window and Frame Configuration
  15. ==============================
  16.  
  17.    On a non-windowing display, Ediff sets things up in one frame,
  18. splitting it between a small control window and the windows for buffers
  19. A, B, and C.  The split between these windows can be horizontal or
  20. vertical, which can be changed interactively by typing `|' while the
  21. cursor is in the control window.
  22.  
  23.    On a window display, Ediff sets up a dedicated frame for Ediff
  24. Control Panel and then it chooses windows as follows: If one of the
  25. buffers is invisible, it is displayed in the currently selected frame.
  26. If a buffer is visible, it is displayed in the frame where it is
  27. visible.  If, according to the above criteria, the two buffers fall
  28. into the same frame, then so be it--the frame will be shared by the
  29. two.  The same algorithm works when you type `C-l' (`ediff-recenter'),
  30. `p' (`ediff-previous-difference'), `n' (`ediff-next-difference'), etc.
  31.  
  32.    The above behavior also depends on whether the current frame is
  33. splittable, dedicated, etc. Unfortunately, the margin of this book is
  34. too narrow to present the details of this remarkable algorithm.
  35.  
  36.    The upshot of all this is that you can compare buffers in one frame
  37. or in different frames.  The former is done by default, while the
  38. latter can be achieved by arranging buffers A, B (and C, if applicable)
  39. to be seen in different frames.  Ediff respects these arrangements,
  40. automatically adapting itself to the multi-frame mode.
  41.  
  42.    Ediff uses the following variables to set up its control panel
  43. (a.k.a. control buffer, a.k.a. quick help window):
  44.  
  45. `ediff-control-frame-parameters'
  46.      You can change or augment this variable including the font, color,
  47.      etc.  The X resource name of Ediff Control Panel frames is
  48.      `Ediff'.  Under X-windows, you can use this name to set up
  49.      preferences in your `~/.Xdefaults', `~/.xrdb', or whatever X
  50.      resource file is in use. Usually this is preferable to changing
  51.      `ediff-control-frame-parameters' directly.  For instance, you can
  52.      specify in `~/.Xdefaults' the color of the control frame using the
  53.      resource `Ediff*background'.
  54.  
  55.      In general, any X resource pertaining the control frame can be
  56.      reached via the prefix `Ediff*'.
  57.  
  58. `ediff-control-frame-position-function'
  59.      The preferred way of specifying the position of the control frame
  60.      is by setting the variable `ediff-control-frame-position-function'
  61.      to an appropriate function.  The default value of this variable is
  62.      `ediff-make-frame-position'. This function places the control
  63.      frame in the vicinity of the North-East corner of the frame
  64.      displaying buffer A.
  65.  
  66.    The following variables can be used to adjust the location produced
  67. by `ediff-make-frame-position' and for related customization.
  68.  
  69. `ediff-narrow-control-frame-leftward-shift'
  70.      Specifies the number of characters for shifting the control frame
  71.      from the rightmost edge of frame A when the control frame is
  72.      displayed as a small window.
  73.  
  74. `ediff-wide-control-frame-rightward-shift'
  75.      Specifies the rightward shift of the control frame from the left
  76.      edge of frame A when the control frame shows the full menu of
  77.      options.
  78.  
  79. `ediff-control-frame-upward-shift'
  80.      Specifies the number of pixels for the upward shift of the control
  81.      frame.
  82.  
  83. `ediff-prefer-iconified-control-frame'
  84.      If this variable is `t', the control frame becomes iconified
  85.      automatically when you toggle the quick help message off.  This
  86.      saves valuable real estate on the screen.  Toggling help back will
  87.      deiconify the control frame.
  88.  
  89.      To start Ediff with an iconified Control Panel, you should set this
  90.      variable to `t' and `ediff-prefer-long-help-message' to `nil'
  91.      (*note Quick Help Customization::.).  This behavior is useful only
  92.      if the window manager is TWM or a derivative. Also, this doesn't
  93.      work under XEmacs, since this editor ignores input from icons.
  94.  
  95.    To make more creative changes in the way Ediff sets up windows, you
  96. can rewrite the function `ediff-setup-windows'.  However, we believe
  97. that detaching Ediff Control Panel from the rest and making it into a
  98. separate frame offers an important opportunity by allowing you to
  99. iconify that frame.  Under Emacs, the icon will usually accept all of
  100. the Ediff commands, but will free up valuable real estate on your screen
  101. (this may depend on your window manager, though).  Iconifying won't do
  102. any good under XEmacs since XEmacs icons are not sensitive to keyboard
  103. input.  The saving grace is that, even if not iconified, the control
  104. frame is very small, smaller than some icons, so it does not take much
  105. space in any case.
  106.  
  107.    The following variable controls how windows are set up:
  108.  
  109. `ediff-window-setup-function'
  110.      The multiframe setup is done by the
  111.      `ediff-setup-windows-multiframe' function, which is the default on
  112.      windowing displays.  The plain setup, one where all windows are
  113.      always in one frame, is done by `ediff-setup-windows-plain', which
  114.      is the default on a non-windowing display (or in an xterm window).
  115.      In fact, under Emacs, you can switch freely between these two
  116.      setups by executing the command `ediff-toggle-multiframe' using
  117.      the Minibuffer of the Menubar.
  118.  
  119.      If you don't like any of these setups, write your own function.
  120.      See the documentation for `ediff-window-setup-function' for the
  121.      basic guidelines.  However, writing window setups is not easy, so
  122.      you should first take a close look at `ediff-setup-windows-plain'
  123.      and `ediff-setup-windows-multiframe'.
  124.  
  125.    You can run multiple Ediff sessions at once, by invoking Ediff
  126. several times without exiting previous Ediff sessions.  Different
  127. sessions may even operate on the same pair of files.
  128.  
  129.    Each session has its own Ediff Control Panel and all the regarding a
  130. particular session is local to the associated control panel buffer.  You
  131. can switch between sessions by suspending one session and then switching
  132. to another control panel.  (Different control panel buffers are
  133. distinguished by a numerical suffix, e.g., `Ediff Control Panel<3>'.)
  134.  
  135. 
  136. File: ediff.info,  Node: Selective Browsing,  Next: Highlighting Difference Regions,  Prev: Window and Frame Configuration,  Up: Customization
  137.  
  138. Selective Browsing
  139. ==================
  140.  
  141.    Sometimes it is convenient to be able to step through only some
  142. difference regions, those that match certain regular expressions, and
  143. to ignore all others.  On other occasions, you may want to ignore
  144. difference regions that match some regular expressions, and to look
  145. only at the rest.
  146.  
  147.    The commands `#f' and `#h' let you do precisely this.
  148.  
  149.    Typing `#f' lets you specify regular expressions that match
  150. difference regions you want to focus on.  We shall call these regular
  151. expressions REGEXP-A, REGEXP-B and REGEXP-C.  Ediff will then start
  152. stepping through only those difference regions where the region in
  153. buffer A matches REGEXP-A and/or the region in buffer B matches
  154. REGEXP-B, etc.  Whether `and' or `or' will be used depends on how you
  155. respond to a question.
  156.  
  157.    When scanning difference regions for the aforesaid regular
  158. expressions, Ediff narrows the buffers to those regions. This means
  159. that you can use the expressions `\`' and `\'' to tie search to the
  160. beginning or end of the difference regions.
  161.  
  162.    On the other hand, typing `#h' lets you specify (hide) uninteresting
  163. regions. That is, if a difference region in buffer A matches REGEXP-A,
  164. the corresponding region in buffer B matches REGEXP-B and (if
  165. applicable) buffer C's region matches REGEXP-C, then the region will be
  166. ignored by the commands `n'/<SPC> (`ediff-next-difference') and
  167. `p'/<DEL> (`ediff-previous-difference') commands.
  168.  
  169.    Typing `#f' and `#h' toggles selective browsing on and off.
  170.  
  171.    Note that selective browsing affects only `ediff-next-difference'
  172. and `ediff-previous-difference', i.e., the commands `n'/<SPC> and
  173. `p'/<DEL>.  `#f' and `#h' do not change the position of the point in
  174. the buffers.  And you can still jump directly (using `j')  to any
  175. numbered difference.
  176.  
  177.    Users can supply their own functions to specify how Ediff should do
  178. selective browsing. To change the default Ediff function, add a
  179. function to `ediff-load-hook' which will do the following assignments:
  180.  
  181.      (setq ediff-hide-regexp-matches-function 'your-hide-function)
  182.      (setq ediff-focus-on-regexp-matches-function 'your-focus-function)
  183.  
  184.    *Useful hint*: To specify a regexp that matches everything, don't
  185. simply type <RET> in response to a prompt. Typing <RET> tells Ediff to
  186. accept the default value, which may not be what you want. Instead, you
  187. should enter something like <^> or <$>. These match every line.
  188.  
  189.    You can use the status command, `i', to find out whether selective
  190. browsing is currently in effect.
  191.  
  192.    The regular expressions you specified are kept in the local variables
  193. `ediff-regexp-focus-A', `ediff-regexp-focus-B', `ediff-regexp-focus-C',
  194. `ediff-regexp-hide-A', `ediff-regexp-hide-B', `ediff-regexp-hide-C'.
  195. Their default value is the empty string (i.e., nothing is hidden or
  196. focused on).  To change the default, set these variables in `.emacs'
  197. using `setq-default'.
  198.  
  199.    In addition to the ability to ignore regions that match regular
  200. expressions, Ediff can be ordered to start skipping over certain
  201. "uninteresting" difference regions.  This is controlled by the following
  202. variable:
  203.  
  204. `ediff-ignore-similar-regions'
  205.      If `t', causes Ediff to skip over "uninteresting" difference
  206.      regions, which are the regions where the variants differ only in
  207.      the amount of the white space and newlines. This feature can be
  208.      toggled on/off interactively, via the command `##'.
  209.  
  210.    *Note:* In order for this feature to work, auto-refining of
  211. difference regions must be on, since otherwise Ediff won't know if there
  212. are fine differences between regions.  On devices where Emacs can
  213. display faces, auto-refining is a default, but it is not turned on by
  214. default on text-only terminals.  In that case, you must explicitly turn
  215. auto-refining on (such as, by typing `@').
  216.  
  217.    *Reassurance:* If many such uninteresting regions appear in a row,
  218. Ediff may take a long time to skip over them because it has to compute
  219. fine differences of all intermediate regions.  This delay does not
  220. indicate any problem.
  221.  
  222. 
  223. File: ediff.info,  Node: Highlighting Difference Regions,  Next: Narrowing,  Prev: Selective Browsing,  Up: Customization
  224.  
  225. Highlighting Difference Regions
  226. ===============================
  227.  
  228.    The following variables control the way Ediff highlights difference
  229. regions:
  230.  
  231. `ediff-before-flag-bol'
  232. `ediff-after-flag-eol'
  233. `ediff-before-flag-mol'
  234. `ediff-after-flag-mol'
  235.      These variables hold strings that Ediff uses to mark the beginning
  236.      and the end of the differences found in files A, B, and C on
  237.      devices where Emacs cannot display faces. Ediff uses different
  238.      flags to highlight regions that begin/end at the beginning/end of
  239.      a line or in a middle of a line.
  240.  
  241. `ediff-current-diff-face-A'
  242. `ediff-current-diff-face-B'
  243. `ediff-current-diff-face-C'
  244.      Ediff uses these faces to highlight current differences on devices
  245.      where Emacs can display faces.  These and subsequently described
  246.      faces can be set either in `.emacs' or in `.Xdefaults'. The X
  247.      resource for Ediff is `Ediff', *not* `emacs'. Please refer to
  248.      Emacs manual for the information on how to set X resources.
  249.  
  250. `ediff-fine-diff-face-A'
  251. `ediff-fine-diff-face-B'
  252. `ediff-fine-diff-face-C'
  253.      Ediff uses these faces to show the fine differences between the
  254.      current differences regions in buffers A, B, and C, respectively.
  255.  
  256. `ediff-even-diff-face-A'
  257. `ediff-even-diff-face-B'
  258. `ediff-even-diff-face-C'
  259. `ediff-odd-diff-face-A'
  260. `ediff-odd-diff-face-B'
  261. `ediff-odd-diff-face-C'
  262.      Non-current difference regions are displayed using these
  263.      alternating faces. The odd and the even faces are actually
  264.      identical on monochrome displays, because without colors options
  265.      are limited.  So, Ediff uses italics to highlight non-current
  266.      differences.
  267.  
  268. `ediff-force-faces'
  269.      Ediff generally can detect when Emacs is running on a device where
  270.      it can use highlighting with faces. However, if it fails to
  271.      determine that faces can be used, the user can set this variable
  272.      to `t' to make sure that Ediff uses faces to highlight differences.
  273.  
  274. `ediff-highlight-all-diffs'
  275.      Indicates whether--on a windowind display--Ediff should highlight
  276.      differences using inserted strings (as on text-only terminals) or
  277.      using colors and highlighting.  Normally, Ediff highlights all
  278.      differences, but the selected difference is highlighted more
  279.      visibly.  One can cycle through various modes of highlighting by
  280.      typing `h'.  By default, Ediff starts in the mode where all
  281.      difference regions are highlighted.  If you prefer to start in the
  282.      mode where unselected differences are not highlighted, you should
  283.      set `ediff-highlight-all-diffs' to `nil'.  Type `h' to restore
  284.      highlighting for all differences.
  285.  
  286.      Ediff lets you switch between the two modes of highlighting.  That
  287.      is, you can switch interactively from highlighting using faces to
  288.      highlighting using string flags, and back.  Of course, switching
  289.      has effect only under a windowing system.  On a text-only terminal
  290.      or in an xterm window, the only available option is highlighting
  291.      with strings.
  292.  
  293. If you want to change the default settings for `ediff-force-faces' and
  294. `ediff-highlight-all-diffs', you must do it *before* Ediff is loaded.
  295.  
  296.    You can also change the defaults for the faces used to highlight the
  297. difference regions.  There are two ways to do this.  The simplest and
  298. the preferred way is to use the customization widget accessible from the
  299. menubar. Ediff's customization group is located under "Tools", which in
  300. turn is under "Programming". The faces that are used to highlight
  301. difference regions are located in the "Highlighting" subgroup of the
  302. Ediff customization group.
  303.  
  304.    The second, much more arcane, method to change default faces is to
  305. include some Lisp code in `~/.emacs'. For instance,
  306.  
  307.      (setq ediff-current-diff-face-A
  308.            (copy-face 'bold-italic 'ediff-current-diff-face-A))
  309.  
  310. would use the pre-defined fase `bold-italic' to highlight the current
  311. difference region in buffer A (this face is not a good choice, by the
  312. way).
  313.  
  314.    If you are unhappy with just *some* of the aspects of the default
  315. faces, you can modify them when Ediff is being loaded using
  316. `ediff-load-hook'. For instance:
  317.  
  318.      (add-hook 'ediff-load-hook
  319.                (function (lambda ()
  320.                            (set-face-foreground
  321.                              ediff-current-diff-face-B "blue")
  322.                            (set-face-background
  323.                              ediff-current-diff-face-B "red")
  324.                            (make-face-italic
  325.                              ediff-current-diff-face-B))))
  326.  
  327.    *Note:* it is not recommended to use `internal-get-face' (or
  328. `get-face' in XEmacs) when defining Ediff's faces, since this may cause
  329. problems when there are several frames with different font sizes.
  330. Instead, use `copy-face' or `set/make-face-...' as shown above.
  331.  
  332. 
  333. File: ediff.info,  Node: Narrowing,  Next: Refinement of Difference Regions,  Prev: Highlighting Difference Regions,  Up: Customization
  334.  
  335. Narrowing
  336. =========
  337.  
  338.    If buffers being compared are narrowed at the time of invocation of
  339. Ediff, `ediff-buffers' will preserve the narrowing range.  However, if
  340. `ediff-files' is invoked on the files visited by these buffers, that
  341. would widen the buffers, since this command is defined to compare the
  342. entire files.
  343.  
  344.    Calling `ediff-regions-linewise' or `ediff-windows-linewise', or the
  345. corresponding `-wordwise' commands, narrows the variants to the
  346. particular regions being compared.  The original accessible ranges are
  347. restored when you quit Ediff.  During the command, you can toggle this
  348. narrowing on and off with the `%' command.
  349.  
  350.    These two variables control this narrowing behavior:
  351.  
  352. `ediff-start-narrowed'
  353.      If `t', Ediff narrows the display to the appropriate range when it
  354.      is invoked with an `ediff-regions...' or `ediff-windows...'
  355.      command.  If `nil', these commands do not automatically narrow,
  356.      but you can still toggle narrowing on and off by typing `%'.
  357.  
  358. `ediff-quit-widened'
  359.      Controls whether on quitting Ediff should restore the accessible
  360.      range that existed before the current invocation.
  361.  
  362. 
  363. File: ediff.info,  Node: Refinement of Difference Regions,  Next: Patch and Diff Programs,  Prev: Narrowing,  Up: Customization
  364.  
  365. Refinement of Difference Regions
  366. ================================
  367.  
  368.    Ediff has variables to control the way fine differences are
  369. highlighted.  This feature gives you control over the process of
  370. refinement.  Note that refinement ignores spaces, tabs, and newlines.
  371.  
  372. `ediff-auto-refine'
  373.      This variable controls whether fine differences within regions are
  374.      highlighted automatically ("auto-refining").  The default is yes
  375.      (`on').
  376.  
  377.      On a slow machine, automatic refinement may be painful.  In that
  378.      case, you can turn auto-refining on or off interactively by typing
  379.      `@'.  You can also turn off display of refining that has already
  380.      been done.
  381.  
  382.      When auto-refining is off, fine differences are shown only for
  383.      regions for which these differences have been computed and saved
  384.      before.  If auto-refining and display of refining are both turned
  385.      off, fine differences are not shown at all.
  386.  
  387.      Typing `*' computes and displays fine differences for the current
  388.      difference region, regardless of whether auto-refining is turned
  389.      on.
  390.  
  391. `ediff-auto-refine-limit'
  392.      If auto-refining is on, this variable limits the size of the
  393.      regions to be auto-refined.  This guards against the possible
  394.      slowdown that may be caused by extraordinary large difference
  395.      regions.
  396.  
  397.      You can always refine the current region by typing `*'.
  398.  
  399. `ediff-forward-word-function'
  400.      This variable controls how fine differences are computed.  The
  401.      value must be a Lisp function that determines how the current
  402.      difference region should be split into words.
  403.  
  404.      Fine differences are computed by first splitting the current
  405.      difference region into words and then passing the result to
  406.      `ediff-diff-program'. For the default forward word function (which
  407.      is `ediff-forward-word'), a word is a string consisting of letters,
  408.      `-', or `_'; a string of punctuation symbols; a string of digits,
  409.      or a string consisting of symbols that are neither space, nor a
  410.      letter.
  411.  
  412.      This default behavior is controlled by four variables:
  413.      `ediff-word-1', ..., `ediff-word-4'. See the on-line documentation
  414.      for these variables and for the function `ediff-forward-word' for
  415.      an explanation of how to modify these variables.
  416.  
  417.    Sometimes, when a region has too many differences between the
  418. variants, highlighting of fine differences is inconvenient, especially
  419. on color displays.  If that is the case, type `*' with a negative
  420. prefix argument.  This unhighlights fine differences for the current
  421. region.
  422.  
  423.    To unhighlight fine differences in all difference regions, use the
  424. command `@'.  Repeated typing of this key cycles through three
  425. different states: auto-refining, no-auto-refining, and no-highlighting
  426. of fine differences.
  427.  
  428. 
  429. File: ediff.info,  Node: Patch and Diff Programs,  Next: Merging and diff3,  Prev: Refinement of Difference Regions,  Up: Customization
  430.  
  431. Patch and Diff Programs
  432. =======================
  433.  
  434.    This section describes variables that specify the programs to be
  435. used for applying patches and for computing the main difference regions
  436. (not the fine difference regions):
  437.  
  438. `ediff-diff-program'
  439. `ediff-diff3-program'
  440.      These variables specify the programs to use to produce differences
  441.      and do patching.
  442.  
  443. `ediff-diff-options'
  444. `ediff-diff3-options'
  445.      These variables specify the options to pass to the above utilities.
  446.  
  447.      In `ediff-diff-options', it may be useful to specify options such
  448.      as `-w' that ignore certain kinds of changes.  However, Ediff does
  449.      not let you use the option `-c', as it doesn't recognize this
  450.      format yet.
  451.  
  452. `ediff-patch-program'
  453.      The program to use to apply patches. Since there are certain
  454.      incompatibilities between the different versions of the patch
  455.      program, the best way to stay out of trouble is to use a
  456.      GNU-compatible version.  Otherwise, you may have to tune the
  457.      values of the variables `ediff-patch-options',
  458.      `ediff-backup-specs', and `ediff-backup-extension' as described
  459.      below.
  460.  
  461. `ediff-patch-options'
  462.      Options to pass to `ediff-patch-program'.
  463.  
  464.      Note: the `-b' and `-z' options should be specified in
  465.      `ediff-backup-specs', not in `ediff-patch-options'.
  466.  
  467.      It is recommended to pass the `-f' option to the patch program, so
  468.      it won't ask questions. However, some implementations don't accept
  469.      this option, in which case the default value of this variable
  470.      should be changed.
  471.  
  472. `ediff-backup-extension'
  473.      Backup extension used by the patch program. Must be specified,
  474.      even if `ediff-backup-specs' is given.
  475.  
  476. `ediff-backup-specs'
  477.      Backup directives to pass to the patch program.  Ediff requires
  478.      that the old version of the file (before applying the patch) is
  479.      saved in a file named `the-patch-file.extension'. Usually
  480.      `extension' is `.orig', but this can be changed by the user, and
  481.      may also be system-dependent. Therefore, Ediff needs to know the
  482.      backup extension used by the patch program.
  483.  
  484.      Some versions of the patch program let the user specify `-b
  485.      backup-extension'.  Other versions only permit `-b', which
  486.      (usually) assumes the extension `.orig'.  Yet others force you to
  487.      use `-z<backup-extension>'.
  488.  
  489.      Note that both `ediff-backup-extension' and `ediff-backup-specs'
  490.      must be properly set. If your patch program takes the option `-b',
  491.      but not `-b extension', the variable `ediff-backup-extension' must
  492.      still be set so Ediff will know which extension to use.
  493.  
  494. `ediff-custom-diff-program'
  495. `ediff-custom-diff-options'
  496.      Because Ediff limits the options you may want to pass to the `diff'
  497.      program, it partially makes up for this drawback by letting you
  498.      save the output from `diff' in your preferred format, which is
  499.      specified via the above two variables.
  500.  
  501.      The output generated by `ediff-custom-diff-program' (which doesn't
  502.      even have to be a standard-style `diff'!) is not used by Ediff. It
  503.      is provided exclusively so that you can refer to it later, send it
  504.      over email, etc.  For instance, after reviewing the differences,
  505.      you may want to send context differences to a colleague.  Since
  506.      Ediff ignores the `-c' option in `ediff-diff-program', you would
  507.      have to run `diff -c' separately just to produce the list of
  508.      differences. Fortunately, `ediff-custom-diff-program' and
  509.      `ediff-custom-diff-options' eliminate this nuisance by keeping a
  510.      copy of a difference list in the desired format in a buffer that
  511.      can be displayed via the command `D'.
  512.  
  513. `ediff-patch-default-directory'
  514.      Specifies the default directory to look for patches.
  515.  
  516. *Warning:* Ediff does not support the output format of VMS `diff'.
  517. Instead, make sure you are using some implementation of POSIX `diff',
  518. such as `gnudiff'.
  519.  
  520. 
  521. File: ediff.info,  Node: Merging and diff3,  Next: Support for Version Control,  Prev: Patch and Diff Programs,  Up: Customization
  522.  
  523. Merging and diff3
  524. =================
  525.  
  526.    Ediff supports three-way comparison via the functions `ediff-files3'
  527. and `ediff-buffers3'.  The interface is the same as for two-way
  528. comparison.  In three-way comparison and merging, Ediff reports if any
  529. two difference regions are identical.  For instance, if the current
  530. region in buffer A is the same as the region in buffer C, then the mode
  531. line of buffer A will display `[=diff(C)]' and the mode line of buffer
  532. C will display `[=diff(A)]'.
  533.  
  534.    Merging is done according to the following algorithm.
  535.  
  536.    If a difference region in one of the buffers, say B, differs from
  537. the ancestor file while the region in the other buffer, A, doesn't,
  538. then the merge buffer, C, gets B's region.  Similarly when buffer A's
  539. region differs from the ancestor and B's doesn't, A's region is used.
  540.  
  541.    If both regions in buffers A and B differ from the ancestor file,
  542. Ediff chooses the region according to the value of the variable
  543. `ediff-default-variant'.  If its value is `default-A' then A's region
  544. is chosen.  If it is `default-B' then B's region is chosen.  If it is
  545. `combined' then the region in buffer C will look like this:
  546.  
  547.      #ifdef NEW  /* variant A */
  548.      difference region from buffer A
  549.      #else  /* variant B */
  550.      difference region from buffer B
  551.      #endif  /* NEW */
  552.  
  553.    The actual strings that separate the regions copied from buffer A
  554. and B are controlled by the variable `ediff-combination-pattern'.  Its
  555. value should be a list of three strings.  The first is inserted before
  556. the difference region of buffer A; the second string goes between the
  557. regions; the third goes after region B, as shown in the above example.
  558.  
  559.    In addition to the state of the difference, Ediff displays the state
  560. of the merge for each region. If a difference came from buffer A by
  561. default (because both regions A and B were different from the ancestor
  562. and `ediff-default-variant' was set to `default-A') then `[=diff(A)
  563. default-A]' is displayed in the mode line.  If the difference in buffer
  564. C came, say, from buffer B because the difference region in that buffer
  565. differs from the ancestor, but the region in buffer A does not (if
  566. merging with an ancestor) then `[=diff(B) prefer-B]' is displayed.  The
  567. indicators default-A/B and prefer-A/B are inspired by Emerge and have
  568. the same meaning.
  569.  
  570.    Another indicator of the state of merge is `combined'.  It appears
  571. with any difference region in buffer C that was obtained by combining
  572. the difference regions in buffers A and B as explained above.
  573.  
  574.    In addition to the state of merge and state of difference
  575. indicators, while merging with an ancestor file or buffer, Ediff
  576. informs the user when the current difference region in the (normally
  577. invisible) ancestor buffer is empty via the *AncestorEmpty* indicator.
  578. This helps determine if the changes made to the original in variants A
  579. and B represent pure insertion or deletion of text: if the mode line
  580. shows *AncestorEmpty* and the corresponding region in buffers A or B is
  581. not empty, this means that new text was inserted. If this indicator is
  582. not present and the difference regions in buffers A or B are non-empty,
  583. this means that text was modified. Otherwise, the original text was
  584. deleted.
  585.  
  586.    Although the ancestor buffer is normally invisible, Ediff maintains
  587. difference regions there and advances the current difference region
  588. accordingly. All highlighting of difference regions is provided in the
  589. ancestor buffer, except for the fine differences.  Therefore, if
  590. desired, the user can put the ancestor buffer in a separate frame and
  591. watch it there. However, on a TTY, only one frame can be visible at any
  592. given time, and Ediff doesn't support any single-frame window
  593. configuration where all buffers, including the ancestor buffer, would
  594. be visible. However, the ancestor buffer can be displayed by typing `/'
  595. to the control window. (Type `C-l' to hide it again.)
  596.  
  597.    Note that the state-of-difference indicators `=diff(A)' and
  598. `=diff(B)' above are not redundant, even in the presence of a
  599. state-of-merge indicator.  In fact, the two serve different purposes.
  600.  
  601.    For instance, if the mode line displays `=diff(B) prefer(B)' and you
  602. copy a difference region from buffer A to buffer C then `=diff(B)' will
  603. change to `diff-A' and the mode line will display `=diff(A) prefer-B'.
  604. This indicates that the difference region in buffer C is identical to
  605. that in buffer A, but originally buffer C's region came from buffer B.
  606. This is useful to know because you can recover the original difference
  607. region in buffer C by typing `r'.
  608.  
  609.    Ediff never changes the state-of-merge indicator, except in response
  610. to the `!' command (see below), in which case the indicator is lost.
  611. On the other hand, the state-of-difference indicator is changed
  612. automatically by the copying/recovery commands, `a', `b', `r', `+'.
  613.  
  614.    The `!' command loses the information about origins of the regions
  615. in the merge buffer (default-A, prefer-B, or combined).  This is because
  616. recomputing differences in this case means running `diff3' on buffers
  617. A, B, and the merge buffer, not on the ancestor buffer.  (It makes no
  618. sense to recompute differences using the ancestor file, since in the
  619. merging mode Ediff assumes that you have not edited buffers A and B,
  620. but that you may have edited buffer C, and these changes are to be
  621. preserved.)  Since some difference regions may disappear as a result of
  622. editing buffer C and others may arise, there is generally no simple way
  623. to tell where the various regions in the merge buffer came from.
  624.  
  625.    In three-way comparison, Ediff tries to disregard regions that
  626. consist entirely of white space.  For instance, if, say, the current
  627. region in buffer A consists of the white space only (or if it is
  628. empty), Ediff will not take it into account for the purpose of
  629. computing fine differences. The result is that Ediff can provide a
  630. better visual information regarding the actual fine differences in the
  631. non-white regions in buffers B and C. Moreover, if the regions in
  632. buffers B and C differ in the white space only, then a message to this
  633. effect will be displayed.
  634.  
  635.    In the merge mode, the share of the split between window C (the
  636. window displaying the merge-buffer) and the windows displaying buffers
  637. A and B is controlled by the variable `ediff-merge-window-share'.  Its
  638. default value is 0.5.  To make the merge-buffer window smaller, reduce
  639. this amount.
  640.  
  641.    We don't recommend increasing the size of the merge-window to more
  642. than half the frame (i.e., to increase the value of
  643. `ediff-merge-window-share') to more than 0.5, since it would be hard to
  644. see the contents of buffers A and B.
  645.  
  646.    You can temporarily shrink the merge window to just one line by
  647. typing `s'.  This change is temporary, until Ediff finds a reason to
  648. redraw the screen.  Typing `s' again restores the original window size.
  649.  
  650.    With a positive prefix argument, the `s' command will make the merge
  651. window slightly taller.  This change is persistent.  With ``-'' or with
  652. a negative prefix argument, the command `s' makes the merge window
  653. slightly shorter.  This change also persistent.
  654.  
  655.    Ediff lets you automatically ignore the regions where only one of the
  656. buffers A and B disagrees with the ancestor.  To do this, set the
  657. variable `ediff-show-clashes-only' to non-`nil'.
  658.  
  659.    You can toggle this feature interactively by typing `$'.
  660.  
  661.    Note that this variable affects only the show next/previous
  662. difference commands.  You can still jump directly to any difference
  663. region directly using the command `j' (with a prefix argument
  664. specifying the difference number).
  665.  
  666.    The variable `ediff-autostore-merges' controls what happens to the
  667. merge buffer when Ediff quits. If the value is `nil', nothing is done
  668. to the merge buffer--it will be the user's responsibility to save it.
  669. If the value is `t', the user will be asked where to save the buffer
  670. and whether to delete it afterwards. It the value is neither `nil' nor
  671. `t', the merge buffer is saved *only* if this merge session was invoked
  672. from a group of related Ediff session, such as those that result from
  673. `ediff-merge-directories', `ediff-merge-directory-revisions', etc.
  674. *Note Session Groups::. This behavior is implemented in the function
  675. `ediff-maybe-save-and-delete-merge', which is a hook in
  676. `ediff-quit-merge-hook'. The user can supply a different hook, if
  677. necessary.
  678.  
  679.    The variable `ediff-autostore-merges' is buffer-local, so it can be
  680. set in a per-buffer manner. Therefore, use `setq-default' to globally
  681. change this variable.
  682.  
  683. 
  684. File: ediff.info,  Node: Support for Version Control,  Next: Customizing the Mode Line,  Prev: Merging and diff3,  Up: Customization
  685.  
  686. Support for Version Control
  687. ===========================
  688.  
  689.    Ediff supports version control and lets you compare versions of files
  690. visited by Emacs buffers via the function `ediff-revision'. This
  691. feature is controlled by the following variables:
  692.  
  693. `ediff-version-control-package'
  694.      A symbol. The default is `vc'.
  695.  
  696.      If you are like most Emacs users, Ediff will use VC as the version
  697.      control package. This is the standard Emacs interface to RCS, CVS,
  698.      and SCCS.
  699.  
  700.      However, if your needs are better served by other interfaces, you
  701.      will have to tell Ediff which version control package you are
  702.      using, e.g.,
  703.           (setq ediff-version-control-package 'rcs)
  704.  
  705.      Apart from the standard `vc.el', Ediff supports three other
  706.      interfaces to version control: `rcs.el', `pcl-cvs.el', and
  707.      `generic-sc.el'.  The package `rcs.el' is written by Sebastian
  708.      Kremer <sk@thp.Uni-Koeln.DE> and is available as
  709.           `ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z'
  710.           `ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z'
  711.      The packages `pcl-cvs.el' and `generic-sc.el' are found in XEmacs
  712.      distribution.
  713.  
  714.    Ediff's interface to the above packages allows the user to compare
  715. the versions of the current buffer or to merge them (with or without an
  716. ancestor-version). These operations can also be performed on directories
  717. containing files under version control.
  718.  
  719.    In case of `pcl-cvs.el', Ediff can also be invoked via the function
  720. `run-ediff-from-cvs-buffer'--see the documentation string for this
  721. function.
  722.  
  723. 
  724. File: ediff.info,  Node: Customizing the Mode Line,  Next: Miscellaneous,  Prev: Support for Version Control,  Up: Customization
  725.  
  726. Customizing the Mode Line
  727. =========================
  728.  
  729.    When Ediff is running, the mode line of `Ediff Control Panel' buffer
  730. shows the current difference number and the total number of difference
  731. regions in the two files.
  732.  
  733.    The mode line of the buffers being compared displays the type of the
  734. buffer (`A:', `B:', or `C:') and (usually) the file name.  Ediff tries
  735. to be intelligent in choosing the mode line buffer identification.  In
  736. particular, it works well with the `uniquify.el' and `mode-line.el'
  737. packages (which improve on the default way in which Emacs displays
  738. buffer identification).  If you don't like the way Ediff changes the
  739. mode line, you can use `ediff-prepare-buffer-hook' to modify the mode
  740. line.
  741.  
  742. 
  743. File: ediff.info,  Node: Miscellaneous,  Next: Notes on Heavy-duty Customization,  Prev: Customizing the Mode Line,  Up: Customization
  744.  
  745. Miscellaneous
  746. =============
  747.  
  748.    Here are a few other variables for customizing Ediff:
  749.  
  750. `ediff-split-window-function'
  751.      Controls the way you want the window be split between file-A and
  752.      file-B (and file-C, if applicable).  It defaults to the vertical
  753.      split (`split-window-vertically', but you can set it to
  754.      `split-window-horizontally', if you so wish.  Ediff also lets you
  755.      switch from vertical to horizontal split and back interactively.
  756.  
  757.      Note that if Ediff detects that all the buffers it compares are
  758.      displayed in separate frames, it assumes that the user wants them
  759.      to be so displayed and stops splitting windows.  Instead, it
  760.      arranges for each buffer to be displayed in a separate frame. You
  761.      can switch to the one-frame mode by hiding one of the buffers
  762.      A/B/C.
  763.  
  764.      You can also swap the windows where buffers are displayed by typing
  765.      `~'.
  766.  
  767. `ediff-merge-split-window-function'
  768.      Controls how windows are split between buffers A and B in the
  769.      merge mode.  This variable is like `ediff-split-window-function',
  770.      but it defaults to `split-window-horizontally' instead of
  771.      `split-window-vertically'.
  772.  
  773. `ediff-make-wide-display-function'
  774.      The value is a function to be called to widen the frame for
  775.      displaying the Ediff buffers.  See the on-line documentation for
  776.      `ediff-make-wide-display-function' for details.  It is also
  777.      recommended to look into the source of the default function
  778.      `ediff-make-wide-display'.
  779.  
  780.      You can toggle wide/regular display by typing `m'.  In the wide
  781.      display mode, buffers A, B (and C, when applicable) are displayed
  782.      in a single frame that is as wide as the entire workstation
  783.      screen.  This is useful when files are compared side-by-side.  By
  784.      default, the display is widened without changing its height.
  785.  
  786. `ediff-use-last-dir'
  787.      Controls the way Ediff presents the default directory when it
  788.      prompts the user for files to compare.  If `nil', Ediff uses the
  789.      default directory of the current buffer when it prompts the user
  790.      for file names.  Otherwise, it will use the directories it had
  791.      previously used for files A, B, or C, respectively.
  792.  
  793. `ediff-no-emacs-help-in-control-buffer'
  794.      If `t', makes `C-h' behave like the <DEL> key, i.e., it will move
  795.      you back to the previous difference rather than invoking help.
  796.      This is useful when, in an xterm window or a text-only terminal,
  797.      the Backspace key is bound to `C-h' and is positioned more
  798.      conveniently than the <DEL> key.
  799.  
  800. `ediff-toggle-read-only-function'
  801.      This variable's value is a function that Ediff uses to toggle the
  802.      read-only property in its buffers.
  803.  
  804.      The default function that Ediff uses simply toggles the read-only
  805.      property, unless the file is under version control.  For a
  806.      checked-in file under version control, Ediff first tries to check
  807.      the file out.
  808.  
  809. `ediff-make-buffers-readonly-at-startup nil'
  810.      If t, all variant buffers are made read-only at Ediff startup.
  811.  
  812. `ediff-keep-variants'
  813.      The default is `t', meaning that the buffers being compared or
  814.      merged will be preserved when Ediff quits. Setting this to `nil'
  815.      causes Ediff to offer the user a chance to delete these buffers
  816.      (if they are not modified).  Supplying a prefix argument to the
  817.      quit command (`q') temporarily reverses the meaning of this
  818.      variable. This is convenient when the user prefers one of the
  819.      behaviors most of the time, but occasionally needs the other
  820.      behavior.
  821.  
  822.      However, Ediff temporarily resets this variable to `t' if it is
  823.      invoked via one of the "buffer" jobs, such as `ediff-buffers'.
  824.      This is because it is all too easy to loose day's work otherwise.
  825.      Besides, in a "buffer" job, the variant buffers have already been
  826.      loaded prior to starting Ediff, so Ediff just preserves status quo
  827.      here.
  828.  
  829.      Using `ediff-cleanup-hook', one can make Ediff delete the variants
  830.      unconditionally (e.g., by making `ediff-janitor' into one of these
  831.      hooks).
  832.  
  833. `ediff-grab-mouse'
  834.      Default is `t'.  Normally, Ediff grabs mouse and puts it in its
  835.      control frame.  This is useful since the user can be sure that
  836.      when he needs to type an Ediff command the focus will be in an
  837.      appropriate Ediff's frame.  However, some users prefer to move the
  838.      mouse by themselves.  The above variable, if set to `maybe', will
  839.      prevent Ediff from grabbing the mouse in many situations, usually
  840.      after commands that may take more time than usual. In other
  841.      situation, Ediff will continue grabbing the mouse and putting it
  842.      where it believes is appropriate.  If the value is `nil', then
  843.      mouse is entirely user's responsibility.  Try different settings
  844.      and see which one is for you.
  845.  
  846. 
  847. File: ediff.info,  Node: Notes on Heavy-duty Customization,  Prev: Miscellaneous,  Up: Customization
  848.  
  849. Notes on Heavy-duty Customization
  850. =================================
  851.  
  852.    Some users need to customize Ediff in rather sophisticated ways,
  853. which requires different defaults for different kinds of files (e.g.,
  854. SGML, etc.).  Ediff supports this kind of customization in several
  855. ways.  First, most customization variables are buffer-local. Those that
  856. aren't are usually accessible from within Ediff Control Panel, so one
  857. can make them local to the panel by calling make-local-variable from
  858. within `ediff-startup-hook'.
  859.  
  860.    Second, the function `ediff-setup' accepts an optional sixth
  861. argument which has the form `((VAR-NAME-1 . VAL-1) (VAR-NAME-2 . VAL-2)
  862. ...)'.  The function `ediff-setup' sets the variables in the list to
  863. the respective values, locally in the Ediff control buffer.  This is an
  864. easy way to throw in custom variables (which usually should be
  865. buffer-local) that can then be tested in various hooks.
  866.  
  867.    Make sure the variable `ediff-job-name' and `ediff-word-mode' are set
  868. properly in this case, as some things in Ediff depend on this.
  869.  
  870.    Finally, if you want custom-tailored help messages, you can set the
  871. variables `ediff-brief-help-message-function' and
  872. `ediff-long-help-message-function' to functions that return help
  873. strings.
  874.  
  875.    When customizing Ediff, some other variables are useful, although
  876. they are not user-definable. They are local to the Ediff control
  877. buffer, so this buffer must be current when you access these variables.
  878. The control buffer is accessible via the variable
  879. `ediff-control-buffer', which is also local to that buffer. It is
  880. usually used for checking if the current buffer is also the control
  881. buffer.
  882.  
  883.    Other variables of interest are:
  884. `ediff-buffer-A'
  885.      The first of the data buffers being compared.
  886.  
  887. `ediff-buffer-B'
  888.      The second of the data buffers being compared.
  889.  
  890. `ediff-buffer-C'
  891.      In three-way comparisons, this is the third buffer being compared.
  892.      In merging, this is the merge buffer.  In two-way comparison, this
  893.      variable is nil.
  894.  
  895. `ediff-window-A'
  896.      The window displaying buffer A. If buffer A is not visible, this
  897.      variable is nil or it may be a dead window.
  898.  
  899. `ediff-window-B'
  900.      The window displaying buffer B.
  901.  
  902. `ediff-window-C'
  903.      The window displaying buffer C, if any.
  904.  
  905. `ediff-control-frame'
  906.      A dedicated frame displaying the control buffer, if it exists.  It
  907.      is non-nil only if Ediff uses the multiframe display, i.e., when
  908.      the control buffer is in its own frame.
  909.  
  910. 
  911. File: ediff.info,  Node: Credits,  Next: Index,  Prev: Customization,  Up: Top
  912.  
  913. Credits
  914. *******
  915.  
  916.    Ediff was written by Michael Kifer <kifer@cs.sunysb.edu>. It was
  917. inspired by emerge.el written by Dale R. Worley <drw@math.mit.edu>.  An
  918. idea due to Boris Goldowsky <boris@cs.rochester.edu> made it possible
  919. to highlight fine differences in Ediff buffers. Alastair Burt
  920. <burt@dfki.uni-kl.de> ported Ediff to XEmacs, Eric Freudenthal
  921. <freudent@jan.ultra.nyu.edu> made it work with VC, Marc Paquette
  922. <marcpa@cam.org> wrote the toolbar support package for Ediff, and
  923. Hrvoje Niksic <hniksic@srce.hr> adapted it to the Emacs customization
  924. package.
  925.  
  926.    Many people provided help with bug reports, patches, and advice.
  927. Without them, Ediff would not be nearly as useful as it is today.  Here
  928. is a full list of contributors (I hope I didn't miss anyone):
  929.  
  930.      Neal Becker (neal@ctd.comsat.com),
  931.      Alastair Burt (burt@dfki.uni-kl.de),
  932.      Paul Bibilo (peb@delcam.co.uk),
  933.      Kevin Broadey (KevinB@bartley.demon.co.uk),
  934.      Harald Boegeholz (hwb@machnix.mathematik.uni-stuttgart.de),
  935.      Bradley A. Bosch (brad@lachman.com),
  936.      Michael D. Carney  (carney@ltx-tr.com),
  937.      Jin S. Choi (jin@atype.com),
  938.      Scott Cummings (cummings@adc.com),
  939.      Albert Dvornik (bert@mit.edu),
  940.      Eric Eide (eeide@asylum.cs.utah.edu),
  941.      Paul Eggert (eggert@twinsun.com),
  942.      Kevin Esler (esler@ch.hp.com),
  943.      Robert Estes (estes@ece.ucdavis.edu),
  944.      Jay Finger (jayf@microsoft.com),
  945.      Xavier Fornari (xavier@europe.cma.fr),
  946.      Eric Freudenthal (freudent@jan.ultra.nyu.edu),
  947.      Job Ganzevoort (Job.Ganzevoort@cwi.nl),
  948.      Boris Goldowsky (boris@cs.rochester.edu),
  949.      Allan Gottlieb (gottlieb@allan.ultra.nyu.edu),
  950.      Thorbjoern Hansen (thorbjoern.hansen@mchp.siemens.de),
  951.      Xiaoli Huang (hxl@epic.com),
  952.      Lars Magne Ingebrigtsen (larsi@ifi.uio.no),
  953.      Larry Gouge (larry@itginc.com),
  954.      Karl Heuer (kwzh@gnu.ai.mit.edu),
  955.      (irvine@lks.csi.com),
  956.      (jaffe@chipmunk.cita.utoronto.ca),
  957.      David Karr (dkarr@nmo.gtegsc.com),
  958.      Norbert Kiesel (norbert@i3.informatik.rwth-aachen.de),
  959.      Leigh L Klotz (klotz@adoc.xerox.com),
  960.      Fritz Knabe (Fritz.Knabe@ecrc.de),
  961.      Heinz Knutzen (hk@informatik.uni-kiel.d400.de),
  962.      Andrew Koenig (ark@research.att.com),
  963.      Ken Laprade (laprade@dw3f.ess.harris.com),
  964.      Will C Lauer (wcl@cadre.com),
  965.      Richard Levitte (levitte@e.kth.se),
  966.      Mike Long (mike.long@analog.com),
  967.      Martin Maechler (maechler@stat.math.ethz.ch),
  968.      Simon Marshall (simon@gnu.ai.mit.edu),
  969.      Richard Mlynarik (mly@adoc.xerox.com),
  970.      Chris Murphy (murphycm@sun.aston.ac.uk),
  971.      Erik Naggum (erik@naggum.no),
  972.      Eyvind Ness (Eyvind.Ness@hrp.no),
  973.      Ray Nickson (nickson@cs.uq.oz.au),
  974.      David Petchey (petchey_david@jpmorgan.com),
  975.      Benjamin Pierce (benjamin.pierce@cl.cam.ac.uk),
  976.      Tibor Polgar (tlp00@spg.amdahl.com),
  977.      David Prince (dave0d@fegs.co.uk),
  978.      Paul Raines (raines@slac.stanford.edu),
  979.      Bill Richter (richter@math.nwu.edu),
  980.      C.S. Roberson (roberson@aur.alcatel.com),
  981.      Kevin Rodgers (kevin.rodgers@ihs.com),
  982.      Sandy Rutherford (sandy@ibm550.sissa.it),
  983.      Heribert Schuetz (schuetz@ecrc.de),
  984.      Andy Scott (ascott@pcocd2.intel.com),
  985.      Axel Seibert (axel@tumbolia.ppp.informatik.uni-muenchen.de),
  986.      Scott O. Sherman (Scott.Sherman@mci.com),
  987.      Richard Stallman (rms@gnu.ai.mit.edu),
  988.      Richard Stanton (stanton@haas.berkeley.edu),
  989.      Ake Stenhoff (etxaksf@aom.ericsson.se),
  990.      Stig (stig@hackvan.com),
  991.      Peter Stout (Peter_Stout@cs.cmu.edu),
  992.      Chuck Thompson (cthomp@cs.uiuc.edu),
  993.      Ray Tomlinson (tomlinso@bbn.com),
  994.      Raymond Toy (toy@rtp.ericsson.se),
  995.      Philippe Waroquiers (philippe.waroquiers@eurocontrol.be),
  996.      Klaus Weber (gizmo@zork.north.de),
  997.      Ben Wing (wing@666.com),
  998.      Ilya Zakharevich (ilya@math.ohio-state.edu),
  999.      Eli Zaretskii (eliz@is.elta.co.il)
  1000.  
  1001.